package model

import (
	"community_end/utils/errmsg"
	"gorm.io/gorm"
)

type Tip struct {
	gorm.Model
	Content string `json:"content"`
	Author  string `json:"author"`
	Type    int    `json:"type"`
}

func (Tip) TableName() string {
	return "tip"
}

func SelectTodayTip() (Tip, int) {
	var tip Tip
	err := db.First(&tip).Error
	if err != nil {
		return Tip{}, errmsg.TIP_SELECT_FAILED
	}
	return tip, errmsg.SUCCESS
}
